home *** CD-ROM | disk | FTP | other *** search
/ Celestin Apprentice 7 / Apprentice-Release7.iso / Environments / Clean 1.2.4 / IOInterface / deltaEventIO.dcl < prev    next >
Encoding:
Modula Definition  |  1997-04-23  |  2.4 KB  |  73 lines  |  [TEXT/3PRM]

  1. definition module deltaEventIO;
  2.  
  3.  
  4. //    Version 0.8 to 1.0
  5.  
  6. /*
  7.     Definition of IOState: the environment parameter on which all
  8.                                     I/O functions operate.
  9.     Definition of EVENTS : the environment parameter to start I/O.
  10.  
  11.     The operations on the IOState to create interactions.
  12.  
  13. ::    *EVENTS;
  14. ::    *IOState *s;
  15.  
  16. OpenEvents :: *World -> (!EVENTS, !*World);
  17. //    OpenEvents retrieves the event stream from the world.
  18.  
  19. CloseEvents :: !EVENTS !*World -> *World;
  20.  
  21. /*    CloseEvents replaces the event stream in the world. Event streams that
  22.     opened again, otherwise a run-time error will occur.
  23. */
  24.  
  25. */
  26.  
  27. ::    InitialIO *s    :== [s -> *((IOState s) -> (s, IOState s))];
  28.  
  29. //    Starting an interaction:
  30.  
  31. StartIO    :: !(IOSystem *s (IOState *s)) !*s !(InitialIO *s) !EVENTS
  32.     ->    (!*s, !EVENTS);
  33.  
  34. /*    StartIO starts a new interaction specified by the IOSystem argument.
  35.     Of each device only the first occurrence is taken into account. The
  36.     program state argument serves as initial program state. The first
  37.     functions to be evaluated are given in InitialIO from left-to-right.
  38.     StartIO returns the final program state and the resulting events.
  39.     In this version the program state must be unique.
  40. */
  41.  
  42. NestIO    :: !(IOSystem *t (IOState *t)) !*t !(InitialIO *t) !(IOState *s)
  43.     ->    (!*t, !IOState *s);
  44.  
  45. /*    NestIO starts a new interaction. It replaces the current interaction
  46.     (specified by the IOState argument) with a completely new one
  47.     (specified by the IOSystem argument). It hides the devices of the
  48.     current interaction (if any) and fills the IOState with the devices
  49.     that are specified in the IOSystem argument. Of each device only the
  50.     first occurrence is taken into account. The program state argument
  51.     serves as initial program state. The first functions to be evaluated
  52.     are given in InitialIO from left-to-right.
  53.     NestIO returns the final program state and the original IOState such
  54.     that the original interaction re-appears. In this version the program
  55.     state must be unique.
  56. */
  57.  
  58. QuitIO    :: !(IOState s) -> IOState s;
  59.  
  60. /*    QuitIO closes all devices that are held in the IOState argument.
  61.     The resulting (empty) IOState will cause StartIO to terminate. QuitIO
  62.     is the only function which terminates StartIO.
  63. */
  64.  
  65. ChangeIOState    :: ![(IOState s) -> IOState s ] !(IOState s) -> IOState s;
  66.  
  67. /*    ChangeIOState applies the functions in its first argument in
  68.     consecutive order to the second (IOState) argument.
  69. */
  70.  
  71. import    deltaIOSystem;
  72. from    ioState import IOState, EVENTS, OpenEvents, CloseEvents;
  73.